package
{
	import flash.display.MovieClip;
	
	import org.odefu.flash.display.OdefuMovieClip;
	import org.odefu.flash.display.OdefuMovieClipFactory;
	
	import starling.core.Starling;
	import starling.display.Quad;
	import starling.display.Sprite;
	import starling.events.Event;

	public class StarlingCanvas extends Sprite
	{
		public static var mc:MovieClip;

		private const dot:Quad = new Quad(5, 5, 0xFFFF00);
		
		private var omc:OdefuMovieClip;
		
		public function StarlingCanvas()
		{
			super();
			
			addEventListener(Event.ADDED_TO_STAGE, addedToStage);
		}
		
		private function addedToStage(event:Event):void
		{
			removeEventListener(Event.ADDED_TO_STAGE, addedToStage);
			
			displayMovieClip();
		}
		
		private function displayMovieClip():void
		{
			omc = OdefuMovieClipFactory.create(mc);
			omc.x = stage.stageWidth >> 1;
			omc.y = stage.stageHeight >> 1;
			addChild(omc);
			Starling.juggler.add(omc);
			
			dot.x = stage.stageWidth >> 1;
			dot.y = stage.stageHeight >> 1;
			addChild(dot);
		}
	}
}